namespace CarErp.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class CarPurchaseApprovalPaper : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.CarPurchaseApprovalPaper",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Comment = c.String(nullable: false, maxLength: 800, storeType: "nvarchar"),
                        ApprovalTime = c.DateTime(nullable: false, precision: 0),
                        Application_Id = c.Int(nullable: false),
                        Approver_Id = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.CarPurchaseApplication", t => t.Application_Id, cascadeDelete: true)
                .ForeignKey("dbo.User", t => t.Approver_Id, cascadeDelete: true)
                .Index(t => t.Application_Id)
                .Index(t => t.Approver_Id);
            
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.CarPurchaseApprovalPaper", "Approver_Id", "dbo.User");
            DropForeignKey("dbo.CarPurchaseApprovalPaper", "Application_Id", "dbo.CarPurchaseApplication");
            DropIndex("dbo.CarPurchaseApprovalPaper", new[] { "Approver_Id" });
            DropIndex("dbo.CarPurchaseApprovalPaper", new[] { "Application_Id" });
            DropTable("dbo.CarPurchaseApprovalPaper");
        }
    }
}
